<style>
  .box a {
    width: 150px;
    display: inline-block;
  }
</style>

<body>
  <div>
    <input class="i1" type="number" style="width: 200px;" placeholder="输入打开备用页面的页数">
    <input type="button" value="打开备用" class="btn" onclick="openPage(1)">
  </div>
  <div>
    <input class="i2" type="number" style="width: 200px;" placeholder="输入打开备用设置的页数">
    <input type="button" value="打开备用设置" class="btn" onclick="openPage(2)">
  </div>
  <input class="begin" type="number" style="width: 200px;" placeholder="开始页面">
</body>
<!-- (div.box>a[href=https://www.yuque.com/__bzg4554__/a$ target="_blank"]{备用a$}a[href=https://www.yuque.com/__bzg4554__/a$/toc target="_blank"]{备用a$设置})*100 -->

<script>
  for (let i = 1; i <= 10000; i++) {
    let divBox = document.createElement("div");
    divBox.className = "box";
    let a1 = document.createElement("a");
    let a2 = document.createElement("a");
    a1.target = "_blank"
    a2.target = "_blank"
    a1.href = `https://www.yuque.com/bzg4554/a${i}`
    a2.href = `https://www.yuque.com/bzg4554/a${i}/toc/`
    a1.innerText = `备用a${i}`
    a2.innerText = `备用a${i}设置`
    divBox.appendChild(a1);
    divBox.appendChild(a2);
    document.body.appendChild(divBox);
  }

  function openPage(nodeNum = 1) {
    let num = document.querySelector(`.i${nodeNum}`).value || 1;
    let a1 = document.querySelectorAll(`.box a:nth-child(${nodeNum})`)
    if (parseInt(num) > a1.length) return alert("大于节点")
    var begin = document.querySelector(`.begin`).value - 1 || 0;
    for (let i = begin; i < num; i++) {
      setTimeout(() => { a1[i].click() }, 100 * i);
    }
  }



</script>